package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author: hea7en
 * @Date: 2024/5/19 3:08 PM
 * @Description: 套餐菜品关系表
 */
@Mapper
public interface SetmealDishMapper {

    /**
     * 保存套餐菜品关系
     * @param setmealDishes
     */
    void saveBatch(List<SetmealDish> setmealDishes);


    /**
     * 根据dishId查询套餐
     * @param dishIds
     * @return
     */
    List<SetmealDish> getSetmealByDishIds(List<Long> dishIds);

    /**
     * 根据套餐id查询套餐菜品
     * @param setmealId
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id = #{setmealId}")
    List<SetmealDish> getBySetmealId(Long setmealId);

    /**
     * 删除套餐菜品关系
     * @param setmealId
     */
    @Delete("delete from setmeal_dish where setmeal_id = #{setmealId}")
    void deleteBySetmealId(Long setmealId);

    /**
     * 批量删除套餐菜品关系
     * @param ids
     */
    void deleteBySetmealIds(List<Long> ids);
}
